package com.mryan.metrics.utils;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

/**
 * @ClassName InfoSettings
 * @Description
 * @Author zhangdachen
 * @Date 2021-09-07 10:47
 * @Version V1.0
 **/
@Aspect
@Component
public class InfoSettings {
    @Before(value = "@annotation(info)")
    public void interceptInfoBefore(Info info){
        System.out.println(" @Before=>方法开始前触发注解");
    }
    @Around(value = "@annotation(info)")
    public void interceptInfoAround(Info info){
        System.out.println("@Around=>方法整个过程触发注解");
    }
    @After(value = "@annotation(info)")
    public void interceptInfo(Info info){
        System.out.println("@After=>方法结束后触发注解");
    }
    @AfterReturning(value = "@annotation(info)")
    public void interceptInfoAfterReturning(Info info){
        System.out.println(" @AfterReturning=>方法结束后返回时触发注解");
    }
    @AfterThrowing(value = "@annotation(info)")
    public void interceptInfoAfterThrowing(Info info){
        System.out.println("@AfterThrowing=>方法报错时触发注解");
    }
}
